//==============================================================
// Copyright � 2019 Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================

#include "CL/sycl.hpp"
#include <array>
#include <vector>
#include <stdio.h>
#include <stdlib.h>

using namespace sycl;

int main()
{
    queue Q(sycl::cpu_selector{});
    device device = Q.get_device();
    printf("Deivce: %s\n", device.get_info<sycl::info::device::name>().c_str());

    constexpr int size = 16;
    std::array<int, size> data;
    buffer B{data};

    Q.submit([&](handler& h){
        accessor A{B, h};
        h.parallel_for(size, [=](auto& idx){
            A[idx] = idx;
        });
    });

    host_accessor A{B};
    for(int i=0; i<B.size(); i++)
        std::cout << "data[" << i << "] = " << A[i] << "\n";

    return 0;
}
